﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Newtonsoft.Json.Linq;
using xbmc_json_async.System;

namespace xbmc_json_async.Library
{


    /// <summary>
    /// Library.Details.Genre
    /// </summary>
    public class Genre : xbmc_json_async.Types.Library.Details.Genre
    {
        private JObject mJObject;

        public JObject InternalPropertyObject
        {
            get
            {
                return mJObject;
            }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Genre"/> class.
        /// </summary>
        public Genre() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="Genre"/> class.
        /// </summary>
        /// <param name="genreId">The genre id.</param>
        /// <param name="label">The label.</param>
        /// <param name="title">The title.</param>
        /// <param name="thumbnail">The thumbnail.</param>
        /// <param name="propObject">The prop object.</param>
        public Genre(int genreId, string label, string title, string thumbnail,JObject propObject)
        {
            throw new NotImplementedException("Use empty constructor and populate from JsonObject");
            /*Id = genreId;
            Label = label;
            Title = title;
            Thumbnail = thumbnail;
            mJObject = propObject;*/
        }

        /// <summary>
        /// Froms the json object.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        public static Genre FromJsonObject(JObject item)
        {
            var genre = new Genre();
            genre.genreid = XHelpers.JvalInt(item, "genreid");
            genre.label = XHelpers.Jval(item, "label");
            genre.thumbnail = XHelpers.Jval(item, "thumbnail");
            genre.title = XHelpers.Jval(item, "title");

            return genre;
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return label;
        }
    }
}
